package main

import (
	"fmt"
	cache_server "memCache/cache-server"
	"time"
	"unsafe"
)

func main() {
	cache := cache_server.NewMemCache()
	cache.SetMaxMemory("5B")

	cache.Set("int", 1, time.Second)
	cache.Set("bool", false, time.Second)
	cache.Set("str1", "wuwt", time.Second)
	//cache.Set("data", map[string]interface{}{"a": 1}, time.Second)

	cache.Set("int1", 1)
	cache.Set("bool1", false)
	//cache.Set("data1", map[string]interface{}{"a": 1})

	cache.Del("int")
	cache.Del("int")
	val, _ := cache.Get("data")
	fmt.Println("data的值是：", val)
	//cache.Flush()
	cache.Keys()

	/*
		cache.GetValSize(1)
		cache.GetValSize(false)
		cache.GetValSize("aabbccdd")
		cache.GetValSize("赵金鼎")
	*/
	var1 := map[string]interface{}{"a": 1}
	size := unsafe.Sizeof(var1)
	fmt.Println("var1当前数据大小为：", size)

	fmt.Printf("string size:%d---string align: %d\n", unsafe.Sizeof(var1), unsafe.Alignof(var1))

	var2 := "wuwu"
	size1 := unsafe.Sizeof(var2)
	size2 := unsafe.Alignof(var2)
	fmt.Println("var2当前数据大小为：", size1, size2)

}
